<?php
$db_lesson = pc_base::load_model('lesson_model');
$db_people = pc_base::load_model('people_model');
$db_team = pc_base::load_model('team_model');
$db_member = pc_base::load_model('member_model');

$video_id = isset($_GET['video_id']) ? intval($_GET['video_id']) : 0;
$arr_lesson = $db_lesson->select("p_catid=$catid and p_id=$id",'*','','listorder asc');
$video_url = $arr_lesson[$video_id]['video_url'];
?>
{template "content","header"}

{pc:get sql="select * from phpcms_commit where status=1 and a_catid=$catid and a_id=$id order by id desc" num="100" return="all_commit"}{/pc}
<script type="text/javascript" src="{JS_PATH2}commit.gaojian.js?ver={VERSION}"></script>

<!-- header -->
<header class="header clearfix">
	<h3 class="fl"><a href="{get_ref(APP_PATH)}" title="返回上一级"><img src="{IMG_PATH2}icon/back.png" alt="返回上一级"></a></h3>
</header>
<!-- / header -->

<!-- main -->

<main class="main">
	<div class="dk_center">
		<div class="peo_bg" style="background:url({$thumb}) no-repeat 50% 50%; background-size:100% auto;"></div>
		<div class="dk_center1">
			<div class="pc_photo"><img id="iduserimg" src="{$thumb}"></div>
			<div class="dk_txt">{$title}<em></em>
            	<ul>
            	<?php $arr=explode('、', $goodjob)?>
            	{loop $arr $r}
                	<li>{$r}</li>
                {/loop}
                </ul>            
            </div>
			<div class="ds_biaoqian1 clearfix">
				<?php if (strpos($type, '1') !== false) {?>
				    <i class="icon_t"></i>
				<?php }?>
				<?php if (strpos($type, '2') !== false) {?>
				    <i class="icon_j"></i>
				<?php }?>
				<?php if (strpos($type, '3') !== false) {?>
				    <i class="icon_r"></i>
				<?php }?>
			</div>
		</div>
	</div>	
	<div class="bgwhite dk_yaoyue">
	<?php
	$db_member = pc_base::load_model('apply_expert_model');
	$member = pc_base::load_model('member_model');
		$num=$db_member->count('a_id='.$id);
		$passnum=$db_member->count('a_id='.$id.' and status=1');
		$passimg=$db_member->select('a_id='.$id.' and status=1','uid');
		$img='';
		foreach ($passimg as &$v) {
			$img[]=$member->get_one('userid='.$v['uid'],'thumb');
		}
		
	?>
		<div class="dk_yaoyue_num">已有<em>{$num}</em>人想约</div>
		<div class="dk_member clearfix">
			<ul class="fl">
			{loop $img $r}	
				<li><a href="javascript:;"><img src="{$r[thumb]}"></a></li>
			{/loop}				
			</ul>
			<span class="fr">已有{$passnum}人预约成功</span>
		</div>
	</div>
	<div class="dk_detail bgwhite">
		<span class="dk_detail_t">个人简介</span>
		<div class="dk_detail_con1">{$con}</div>
		<div class="btn_click"><img src="{IMG_PATH2}icon/down_lan.png"></div>
	</div>
	<ul class="list_bx clearfix bgwhite">
		<li><div class="gz">￥{$Phone_interviews}<em>/时</em></div>电话约谈</li>
		<li><div class="gz">￥{$appointment}<em>/时</em></div>现场约见</li>
		<li><div class="gz1">{$Task_delegation}</div>任务委托</li>
	</ul>

	<div class="my_solve bgwhite">
		<div class="dk_detail_t">我能解决</div>
		<?php
			$ican = pc_base::load_model('ican_model');
			$ican_data = pc_base::load_model('ican_data_model');
			$arr=$ican->select('p_id='.$id);
			
			$cases = pc_base::load_model('cases_model');
			$hits = pc_base::load_model('hits_model');
			$cases_data = pc_base::load_model('cases_data_model');
			$arr1=$cases->select('p_id='.$id);
			foreach ($arr1 as &$v) {
				$content=$cases_data->get_one('id='.$v['id'],'content');
				$v['content']=$content['content'];
				$hits_id="c-24-".$v['id'];
				$views=$hits->get_one('hitsid="'.$hits_id.'"','views');
				$v['hits']=$views['views'];
			}
		?>
		
      	{loop $arr $r}
        	<div class="dk_huati clearfix"><span class="txt1"><img src="{IMG_PATH2}icon/huati.png"></span><em>{$r['title']}</em></div>
			<div class="dk_con1">{$r[con]}</div>
			<div class="border11"></div>
      	{/loop}
		
		
	</div>
	<div class="product_list bgwhite">
		<div class="dk_detail_t padding1">相关作品及案例</div>
		{if $arr1}	
		<ul class="product_list1">

      	{loop $arr1 $r}
        	<li>
			<a href="{$r['url']}">
				<img src="{$r['thumb']}" class="product_list_img fl">
				<div class="product_list_con">
					<div class="product_list_con_t ellipsis">{$r['title']}</div>
					<div class="product_list_con_c">{str_cut(strip_tags($r[content]),200)}</div>
					<div class="product_list_con_num">{$r[hits]}</div>
				</div>
			</a>
			</li>
      	{/loop}
			
		</ul>
		{else}
		<div class="dk_detail_t padding1">该导师没有相关作品</div>
		{/if}
	</div>

</main>
<!--main end-->
<div class="h_55"></div>
<!--footer-->
<style type="text/css">
.footer1 a .oIcon_11 {
    background: url(../cdn/images/icon/gz_icon11.png) no-repeat 50% 50%;
    background-size: 100% 100%;
}
.header{ position: absolute;}
</style>
<footer class="footer1">
	<ul class="clearfix">
	<?php
		$this->db = pc_base::load_model('collect_model');
		$uid = (int)param::get_cookie('_userid');
		$sql = "uid='$uid' and a_catid='$catid' and a_id='$id'";
        $res = $this->db->get_one($sql);
	?>
	{if $res}
		<li><a id="daoshi" style="color:#ffae13;"><i class="oIcon_11"></i>已关注</a></li>
	{else}	
		<li><a id="daoshi"><i class="oIcon_01"></i>关注导师</a></li>
	{/if}
		<!-- <li><a href="http://igaojian.com/?m=member&c=apply&a=doteacher&catid=2&id=1">我要当导师</a></li> -->

		<li><a href="http://igaojian.com/?m=member&c=apply&a=doyuejian&catid=2&id={$id}">我要约见</a></li>
	</ul>
</footer>
<!-- / footer-->
<script type="text/javascript">
	$(function(){
		var height1 = $(".dk_detail_con1").height();
		$(".dk_detail_con1").css('height','60px');
		if(height1>60){			
			$(".btn_click").toggle(function(){
				$(".dk_detail_con1").css('height','auto');
				$(".btn_click img").attr('src','{IMG_PATH2}icon/down_lan1.png');
				},function(){
					$(".dk_detail_con1").css('height','60px');
					$(".btn_click img").attr('src','{IMG_PATH2}icon/down_lan.png');
				});
		}else{
			$(".btn_click").hide();
			$(".dk_detail_con1").css('height','auto');
		}	

	});
	$('#daoshi').click(function(){
		var id={$id};		
		$.post('index.php?m=api&c=collect&a=guanzhu',{catid:2,id:id},function(data){	
			if(data==1){				
				alert_msg('关注导师成功',function() {
					location.hash = 'commit';
					location.reload();					

				},1000);
			}else{				
				alert_msg('取消关注成功',function() {
					location.hash = 'commit';
					location.reload();
				},1000);				
			}
			window.location.href=window.location.href;
			
		})

	})
</script>
{template "content","footer"}